<?php 
class CBaseForum extends CBaseEosSingular {

	protected $m_intId;
	protected $m_intParentId;
	protected $m_strTitle;
	protected $m_strDescription;
	protected $m_intStatus;
	protected $m_intCreatedBy;
	protected $m_strCreatedOn;
		
	public function __construct() {		
		parent::__construct();
		return true;
	}
	
	/**************************************
	************* SET FUNCTIONS ***********
	**************************************/
	
	public function setId( $intId ) {
		$this->m_intId = $intId;
	}
	
	public function setParentId( $intParentId ) {
		$this->m_intParentId = $intParentId;
	}
	
	public function setTitle( $strTitle ) {
		$this->m_strTitle = $strTitle;
	}

	public function setDescription( $strDescription ) {
		$this->m_strDescription = $strDescription;
	}
	
	public function setStatus( $intStatus ) {
		$this->m_intStatus = $intStatus;
	}
	
	public function setCreatedBy( $intCreatedBy ) {
		$this->m_intCreatedBy = $intCreatedBy ;
	}
	
	public function setCreatedOn( $strCreatedOn ) {
		$this->m_strCreatedOn = $strCreatedOn;
	}
	
	/**************************************
	************* GET FUNCTIONS ***********
	**************************************/
	
	public function getId() {
		return $this->m_intId;
	}
	
	public function getParentId() {
		return $this->m_intParentId;
	}
	
	public function getTitle() {
		return $this->m_strTitle;
	}

	public function getDescription() {
		return $this->m_strDescription;
	}
	
	public function getStatus() {
		return $this->m_intStatus;
	}

	public function getCreatedBy() {
		return $this->m_intCreatedBy;
	}
	
	public function getCreatedOn() {
		return $this->m_strCreatedOn;
	}
	
	/**************************************
	************* DATABASE FUNCTIONS ***********
	**************************************/
	
	public function insert( $intUserId, $objDatabase ) {
		$strSql  = ' INSERT INTO `forums` (`parent_id`, `title`, `description`, `status`, `created_by`)';   
		$strSql .= ' VALUES ( \'' . $this->getParentId() . '\',';
		$strSql .= ' \'' . $this->getTitle() . '\',';
		$strSql .= ' \'' . $this->getDescription() . '\',';
		$strSql .= ' \'' . $this->getStatus() . '\',';		
		$strSql .= ' \'' . $intUserId . '\');';
		
		return parent::insertRecord( $strSql, $objDatabase );
	}
	
	public function update( $objDatabase ) {
		$strSql  = ' UPDATE `forums` SET ';
		$strSql .= ' `title` = \'' . $this->getTitle() . '\',';
		$strSql .= ' `description` = \'' . $this->getDescription() . '\',';
		$strSql .= ' `status` = \'' . $this->getStatus() . '\'';
		$strSql .= ' WHERE `id` = \'' . $this->getId() . '\';';
	
		return parent::updateRecord( $strSql, $objDatabase );
	}
		
	public function delete( $objDatabase ) {
		
		$strSql = ' DELETE FROM `forums` WHERE `id` = ' . $this->getId();
		return parent::deleteRecord( $strSql, $objDatabase );		
	}
	
}

?>